package com.gx.service;

import com.gx.dto.Exposer;
import com.gx.dto.SeckillExecution;
import com.gx.entity.Seckill;
import com.gx.exception.RepeatKillException;
import com.gx.exception.SeckillCloseException;
import com.gx.exception.SeckillException;

import java.util.List;

/**
 * Created by gx on 2017/2/9.
 */
public interface SeckillService {
    /**
     * 查询所有秒杀记录
     * @return
     */
    List<Seckill> getSeckillList();

    /**
     *   查询单个秒杀记录
     * @param seckillId
     * @return
     */
    Seckill getById(long seckillId);

    /**
     *  秒杀开启时输出秒杀接口地址，否则输出系统时间和秒杀时间
     * @param seckillId
     */
     Exposer exportSeckillUrl(long seckillId);

    /**
     * 执行秒杀操作
     * @param seckillId
     * @param userPhone
     * @param md5
     * @return
     * @throws SeckillException
     * @throws SeckillCloseException
     * @throws RepeatKillException
     */
     SeckillExecution executeSeckill(long seckillId, long userPhone , String md5) throws SeckillException ,SeckillCloseException ,RepeatKillException;


    /**
     * 执行秒杀操作  by 存储过程
     * @param seckillId
     * @param userPhone
     * @param md5
     * @return
     * @throws SeckillException
     * @throws SeckillCloseException
     * @throws RepeatKillException
     */
    SeckillExecution executeSeckillProcedure(long seckillId, long userPhone , String md5) throws SeckillException ,SeckillCloseException ,RepeatKillException;



}
